<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="font-img/iconfont.css" />
		<script src="script/jquery.min.js"></script>
		<script src="script/md5.min.js"></script>
		<script src="script/main.js"></script>
		<!--<script src="script/new_file.js"></script>-->
		<style type="text/css">
			* {
				padding: 0;
				margin: 0;
			}
			
			html {
				width: 100%;
				height: 100%;
			}
			
			body {
				width: 100%;
				background: url(img/denglu.jpg) center center no-repeat;
				background-size: cover;
			}
			
			.login_warry {
				width: 100%;
				text-align: center;
				margin-top: 200px;
			}
			
			.denglu {
				background: limegreen;
				width: 100px;
				height: 30px;
				border: 0;
				border-radius: 5px;
				color: #fff;
			}
			
			.input-p {
				margin: 10px 0px 10px 0px;
			}
			
			.input-p span {
				margin-left: -30px;
			}
			
			.input-p input {
				width: 320px;
				height: 30px;
			}
			
			.input-p2 {
				margin-top: 20px;
				margin-left: 15px;
			}
			
			.cuowu {
				width: 100%;
				height: 24px;
				line-height: 30px;
				color: red;
			}
		</style>
	</head>
	<div class="login_warry">
		<p class="input-p"><input onkeyup="value=value.replace(/[^\w\.\/]/ig,'')" placeholder="用户名" class="form-control uname Sign-in"><span class="iconfont icon-denglu "></span></p>
		<p class="input-p"><input type="password" class="form-control pword m-b Sign-in" placeholder="密码" /><span class="iconfont icon-mima-copy"></span></p>
		<div class="cuowu"></div>
		<p class="input-p input-p2"><input type="button" value="登录" class="denglu" /></p>
	</div>

	<body>
	</body>

</html>
<script type="text/javascript">
	$(function() {
		$('.denglu').on('click', function() {
			//            alert(111)
			var uname = $('.uname').val();
			var word = $('.pword').val();
			var m = /^\d{4,10}$/;
			var s = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{4,10}$/;
			if(m.test(uname)) {
				if(s.test(word)) {
					$.ajax({
						type: "get",
						url:BaseUrl+"/proxy/login",
						contentType: "application/json; charset=utf-8",
						data: {
							'name': uname,
							'passWord': word
						},
						success: function(res) {
							console.log(res)
							if(res.error_code == 0) {
								window.location.href = 'index_2.html'
							} else if(res.error_code == 1 || res.error_code == 402) {
								$('.cuowu').html('账号或密码不正确！')
							}
						}
					})
				} else {
					alert('密码必须为长度 4~10 位的数字字母组成')
				}
			} else {
				alert('账号必须为长度4~10位纯数字')

			}
		})
	})
</script>